# -*- coding: utf-8 -*-
# $Id: batchproperties.py 25 2009-02-15 03:19:36Z gkuznets $

# Copyright 2008, 2009 Grigoriy Kuznetsov (gkuznets@yandex.ru)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QWidget, QGridLayout, QLabel
from core.batch import Batch

class BatchProperties(QWidget):
    """Виджет, отображающий свойства выбранной пачки"""
    def __init__(self):
        QWidget.__init__(self)
        # Создаем внутренность виджета
        layout = QGridLayout()
        layout.setMargin(0)
        
        self.info_label = QLabel()
        layout.addWidget(self.info_label)
        layout.setRowStretch(1, 1)
        
        self.setLayout(layout)
  
    def update(self):
        batch = Batch.selected_batch
        if batch:
            self.info_label.setText((u"Пачка:\t%s\nРабот:\t%d" % (batch.name(), batch.papers_count)))
        else:
            self.info_label.clear()
